 <link rel="stylesheet" type="text/css" href="css/validationEngine.jquery.css">
<link rel="stylesheet" type="text/css" href="css/template.css">

<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="js/jquery.validationEngine-vi.js"></script>
<script type="text/javascript" src="js/jquery.validationEngine.js"></script>
<script>
        jQuery(document).ready(function(){
            // binds form submission and fields to the validation engine
            jQuery("#formID").validationEngine();
        });
</script>
<script>
function Del_Info(str){
	var q=confirm('Bạn có chắc chắn muốn xóa hay không?');	
	if(q==true) 
		window.location=str;
	
}
</script>

<?php
$sql="SELECT substr( QUYEN,2,1 ) as mq
FROM qldl_tai_khoan
WHERE ten_dang_nhap = '".$_SESSION['username']."'";
	$query = @mysql_query($sql,$conn);
	$row = @mysql_fetch_array($query);
	if($row['mq']==1){
	 header('Location: index.php?page=k_tour'); 
	}
	else {
	echo  "<script>alert ('Bạn không có quyền truy cập trang này!')</script>"; 
	echo "<meta http-equiv='refresh' content='0;url= index.php'>";
	}
?>
<div class="cpanel-right-tttk">
  <div id="panel-sliders" class="pane-sliders">
    <div class="panel">

<table width="100%" border="0" cellspacing="0" cellpadding="0" style=" padding:10px;">
  <thead>
        <tr style=" padding-bottom:10px;">
        <th  align="left" style="padding-bottom:10px;">CHI TIẾT KHÁCH HÀNG ĐẶT TOUR</th>
        </tr> 
        </thead> 
  <tr valign="top" style="padding:5px;">
    <td width="50%"><div style=" padding:0px; border-top: medium none; border-bottom: medium none; overflow: hidden; height: auto; width:100%" align="left">
      <table width="100%" border="1" bordercolor="#666666" class="adminlist_tt">
        <thead>
          <tr>
            <th colspan="6" align="center"> Danh sách khách hàng đặt tour</th>
<?php if(isset($_POST['btn_luu'])){ 
	if(isset($_POST['ck_lh'])){
	$lh=1;
	}else $lh=0;
	$email=$_GET['id_ct_lh'];
	/////////////////////////////
	$sql1 = "update qldl_chi_tiet_dat_tour set				
				XL_DAT_TOUR='$lh'
			where EMAIL='$email' and MA_TOUR='".$_GET['id_mt']."'
			";
	$query1 = @mysql_query($sql1,$conn);
	if($query1){echo "<script>alert ('Cập nhật thông tin thành công.')</script>";
	echo  "<meta http-equiv='refresh' content='0;url=index.php?page=lh_dt'>";}	
	else echo "<script>alert ('Lỗi cập nhật thông tin!')</script>";
		
}
?>
          </tr>
        </thead>
        <tbody>
           <form action="" method="post" name="form_view" id="form_view">
          <tr>
            <td width="137" align="center">Họ tên</td>
            <td width="140" align="center">Email</td>
            <td width="137" align="center">Số điện thoại</td>
            <td width="188" align="center">Tour</td>
            <td width="310" align="center">Ngày đặt tour</td>
            <td width="95" align="center">Đã liên hệ</td>
          </tr>
          <?php  
	$sql_1="select *
	from qldl_chi_tiet_dat_tour
	inner join qldl_khach_hang_dat_tour
	on qldl_chi_tiet_dat_tour.EMAIL=qldl_khach_hang_dat_tour.EMAIL
	inner join qldl_tour 
	on qldl_chi_tiet_dat_tour.MA_TOUR=qldl_tour.MA_TOUR
	where qldl_khach_hang_dat_tour.EMAIL='".$_GET['id_ct_lh']."'
	and qldl_chi_tiet_dat_tour.MA_TOUR='".$_GET['id_mt']."'
	";
	$query =mysql_query($sql_1);	
	$row1 = @mysql_fetch_array($query);

		{
		?>
          <tr>
            <td><?php echo $row1['TEN_KHACH_HANG'];?></td>
            <td><?php echo $row1['EMAIL'];?></td>
            <td><?php echo $row1['SO_DIEN_THOAI'];?></td>
            <td><?php echo $row1['TEN_TOUR'];?></td>
            <td><?php echo $row1['NGAY_DAT_TOUR'];?></td>
            <td>
           
            <?php  
			$sql_2 = "select * from qldl_chi_tiet_dat_tour where EMAIL='".$row1['EMAIL']."' and MA_TOUR='".$_GET['id_mt']."'";
			$query2 =mysql_query($sql_2);
			$row2=@mysql_fetch_array($query2);
			 
			if($row2['XL_DAT_TOUR']==1){
				?>
			<input type="checkbox" checked name="ck_lh" id="ck_lh" value="1">
			<?php } 
			else {
				?>
            <input type="checkbox" name="ck_lh" id="ck_lh" value="1">
            <?php 
			}
			?>
          </tr>
          <tr>
            <td colspan="6"><input type="submit" name="btn_luu" id="btn_luu" value="Lưu" onclick='window.location.href="index.php?page=lh_dt"'></td>
            </tr>
          <?php 
		  }
		  ?>
          </form>
        </tbody>
      </table>
    </div></td>
  </tr>
</table>

</div>
  </div>
</div>